/*
 * Copyright (c) 2017 Qunar.com. All Rights Reserved.
 */
package com.guoyu.project.common.utils;

import java.io.IOException;

import org.apache.commons.lang3.StringUtils;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.guoyu.project.common.constant.Constants;

/**
 * @author: libo Date: 17-2-15 Time: 下午4:27
 * @version: \$Id$
 */
public class ImageURLSerialize extends JsonSerializer<String> {
    @Override
    public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        if (StringUtils.isNotBlank(value)) {
            gen.writeString(Constants.DOMAIN + value);
        } else {
            gen.writeString(value);
        }
    }
}
